Concurrent programming for shared-memory multiprocessors can include the ability for multiple threads to access the same data. The multiple threads execute on multiple processors, multiple processor cores, or other classes of parallel hardware architecture involving a memory system shared among the processors. The shared-memory model is the most commonly deployed method of multithreaded communication. In such systems, concurrent threads can attempt to access and modify the same data in the shared-memory and perform side effects on this data and the real world through input/output. This can lead to race conditions and other undesired effects in concurrent programming and the stored data.
A major difficulty in implementing concurrent programming involves protecting the state of concurrently accessed data to avoid these undesired effects. Developers often rely on a form of synchronization for concurrency safety. Synchronization often involves the use of locks, which is a form of pessimistic concurrency control mechanism that prevents all other threads from accessing certain data while one thread is already doing so. Locks provide synchronization often at the expense of performance and scalability. Newer synchronization technologies, such as those based on optimistic concurrency control (like Software Transaction Memory), provide far superior performance and scalability than locks. But all contemporary synchronization mechanisms, even optimistic concurrency control systems, eventually provide scalability issues in concurrent programming: when threads wait for another, scalability drops; shared-memory systems use caches whose performance drops significantly when threads share access to memory; and so on.